﻿using System;
using System.Collections.Generic;
using System.Text;
using NIIT.SaoBacDau.Aupi.HospitalManagement.Entities;
using System.Data.SqlClient;
using System.Data;

namespace NIIT.SaoBacDau.Aupi.HospitalManagement.DataAccess
{
    public class DAO_TypeMedical
    {
        public static List<Obj_TypeMedical> ListTypeMedical()
        {
            SqlDataAdapter sqldata = new SqlDataAdapter("Form.Medical", DAO_ConnectDatabase.Connect());
            sqldata.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dtable = new DataTable();
            sqldata.Fill(dtable);
            List<Obj_TypeMedical> List = new List<Obj_TypeMedical>();
            foreach (DataRow dr in dtable.Rows)
            {
                Obj_TypeMedical objTypeMedical = new Obj_TypeMedical();
                objTypeMedical.TypeMedicalID = Convert.ToInt32(dr["TypeMedicalID"].ToString());
                objTypeMedical.NameDetails = dr["NameMedical"].ToString();
                List.Add(objTypeMedical);
            }
            return List;
        }
    }
}
